﻿using System;
using System.Collections.Generic;
using System.Security.Cryptography.X509Certificates;
using System.Text;

namespace 设计模式01
{
    /// <summary>
    /// 桥接模式
    /// </summary>
    public class BridgePattern
    { 

    }

    /// <summary>
    /// 抽象概念中的遥控器，扮演抽象化角色
    /// </summary>
    public class RemoteControl
    {
        public TV Implementor { get; set; }

        public virtual void On()
        {
            Implementor.On();
        }

        public virtual void Off()
        {
            Implementor.Off();
        }

        public virtual void SetChannel()
        {
            Implementor.TuneChannel();
        }
    }

    /// <summary>
    /// 具体控制遥控
    /// </summary>
    public class ConcreteRemote : RemoteControl
    {
        public override void SetChannel()
        {
            base.SetChannel();
        }
    }

    public abstract class TV
    {
        public abstract void On();
        public abstract void Off();
        public abstract void TuneChannel();
    }

    public class ChangHong : TV
    {
        public override void On()
        {
            Console.WriteLine("长虹牌电视机打开了");
        }

        public override void Off()
        {
            Console.WriteLine("长虹牌电视机关掉了");
        }

        public override void TuneChannel()
        {
            Console.WriteLine("长虹牌电视机换频道");
        }
    }


    public class SanXing:TV
    {
        public override void On()
        {
            Console.WriteLine("三星电视机开机了");
        }

        public override void Off()
        {
            Console.WriteLine("三星电视机关机了");
        }

        public override void TuneChannel()
        {
            Console.WriteLine("三星电视机换频道");
        }
    }
}
